<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>NB-loT数据平台</title>
<meta name="Keywords" content="B-JUI,Bootstrap,jquery,ui,前端,框架,开源,OSC,开源框架,knaan"/>
<meta name="Description" content="B-JUI(Best jQuery UI)前端管理框架。轻松开发，专注您的业务，从B-JUI开始！"/> 
<!-- bootstrap - css -->
<link href="B-JUI/themes/css/bootstrap.css" rel="stylesheet">
<!-- formValidation - css -->
<link rel="stylesheet" href="/stylesheets/formValidation.min.css"/>
<!-- <link rel="stylesheet" type="text/css" href="/stylesheets/default.css"> -->

<!-- core - css -->
<link href="B-JUI/themes/css/style.css" rel="stylesheet">

<link href="B-JUI/themes/blue/core.css" id="bjui-link-theme" rel="stylesheet">
<link href="/stylesheets/style.css" rel="stylesheet">
<link href="/stylesheets/jquery-ui.min.css" rel="stylesheet">
<link href="/stylesheets/style.css" rel="stylesheet">
<link href="B-JUI/themes/css/fontsize.css" id="bjui-link-theme" rel="stylesheet">

<!-- plug - css -->
<link href="B-JUI/plugins/kindeditor_4.1.11/themes/default/default.css" rel="stylesheet">


<!-- <link href="B-JUI/plugins/nice-validator-1.0.7/jquery.validator.css" rel="stylesheet"> -->

<link href="B-JUI/plugins/bootstrapSelect/bootstrap-select.css" rel="stylesheet">
<link href="B-JUI/plugins/webuploader/webuploader.css" rel="stylesheet">
<!-- 2018-5-22 日期插件 css -->
<link type="text/css" rel="stylesheet" href="/stylesheets/fonts/iconfont.css">
<!-- 2018-5-22 日期插件 css -->
<link href="B-JUI/themes/css/FA/css/font-awesome.min.css" rel="stylesheet">
<!-- 2018-4-24 日期插件 css -->
<link type="text/css" rel="stylesheet" href="/stylesheets/jedate/jedate.css">
<!-- 2018-4-24 日期插件 css -->
<!-- 2018-5-15 daterangepicker css -->
<link rel="stylesheet" type="text/css" media="all" href="/stylesheets/daterangepicker.css" />
<!-- 2018-5-15 daterangepicker css -->
<!-- Favicons -->
<link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-precomposed.png">
<link rel="shortcut icon" href="assets/ico/favicon.png">
<!--[if lte IE 7]>
<link href="B-JUI/themes/css/ie7.css" rel="stylesheet">
<![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lte IE 9]>
    <script src="B-JUI/other/html5shiv.min.js"></script>
    <script src="B-JUI/other/respond.min.js"></script>
<![endif]-->
<!-- jquery -->
<script src="B-JUI/js/jquery-1.11.3.min.js"></script>

<!-- 2018-5-15 daterangepicker js -->

<script src="javascripts/moment.min.js"></script>
<script src="javascripts/daterangepicker.js"></script>
<!-- 2018-5-15 daterangepicker js -->
<script src="javascripts/public.js"></script>
<script src="javascripts/echarts.min.js"></script>
<script src="javascripts/DD_roundies.min.js"></script>
<script src="B-JUI/js/jquery.cookie.js"></script>
<!--[if lte IE 9]>
<script src="B-JUI/other/jquery.iframe-transport.js"></script>
<script src="javascripts/es5-shim.js"></script>
<![endif]-->
<!-- B-JUI -->
<script src="B-JUI/js/bjui-all.min.js"></script>
<script src="javascripts/jquery-ui.min.js"></script>
<!-- plugins -->
<!-- swfupload for kindeditor -->
<script src="B-JUI/plugins/swfupload/swfupload.js"></script><!-- flash和js相结合而成的文件上传插件 -->
<!-- Webuploader -->
<script src="B-JUI/plugins/webuploader/webuploader.js"></script>
<!-- kindeditor -->

<script src="B-JUI/plugins/kindeditor_4.1.11/kindeditor-all-min.js"></script>

<script src="B-JUI/plugins/kindeditor_4.1.11/lang/zh-CN.js"></script>

<!-- colorpicker -->
<script src="B-JUI/plugins/colorpicker/js/bootstrap-colorpicker.min.js"></script>
<!-- ztree -->
<script src="B-JUI/plugins/ztree/jquery.ztree.all-3.5.js"></script>
<!-- nice validate -->
<!-- <script src="B-JUI/plugins/nice-validator-1.0.7/jquery.validator.js"></script>
<script src="B-JUI/plugins/nice-validator-1.0.7/jquery.validator.themes.js"></script> -->
<!-- bootstrap plugins -->
<script src="B-JUI/plugins/bootstrap.min.js"></script>
<script src="B-JUI/plugins/bootstrapSelect/bootstrap-select.js"></script>
<script src="B-JUI/plugins/bootstrapSelect/defaults-zh_CN.min.js"></script>
<!-- 2018-4-24 日期插件 js -->
<script type="text/javascript" src="javascripts/jedate/jquery.jedate.js"></script>
<!-- 2018-4-24 js -->




<script type="text/javascript" src="javascripts/yi-scroll.js"></script>

<!-- formValidation -->
<script type="text/javascript" src="/javascripts/dist/formValidation.min.js"></script>
<script type="text/javascript" src="/javascripts/dist/bootstrap.js"></script>
<!-- icheck -->
<script src="B-JUI/plugins/icheck/icheck.min.js"></script>
<!-- HighCharts -->
<!-- <script src="B-JUI/plugins/highcharts/highcharts.js"></script>
<script src="B-JUI/plugins/highcharts/highcharts-3d.js"></script>
<script src="B-JUI/plugins/highcharts/themes/gray.js"></script> -->
<!-- other plugins -->
<script src="B-JUI/plugins/other/jquery.autosize.js"></script>
<link href="B-JUI/plugins/uploadify/css/uploadify.css" rel="stylesheet">
<script src="B-JUI/plugins/uploadify/scripts/jquery.uploadify.min.js"></script>
<script src="B-JUI/plugins/download/jquery.fileDownload.js"></script>

<!-- init -->
<script type="text/javascript">
$(function() {
    BJUI.init({
        JSPATH       : 'B-JUI/',         //[可选]框架路径
        PLUGINPATH   : 'B-JUI/plugins/', //[可选]插件路径
        loginInfo    : {url:'login_timeout.html', title:'登录', width:440, height:240}, // 会话超时后弹出登录对话框
        statusCode   : {ok:200, error:300, timeout:301}, //[可选]
        ajaxTimeout  : 300000, //[可选]全局Ajax请求超时时间(毫秒)
        alertTimeout : 3000,  //[可选]信息提示[info/correct]自动关闭延时(毫秒)
        pageInfo     : {total:'totalRow', pageCurrent:'pageCurrent', pageSize:'pageSize', orderField:'orderField', orderDirection:'orderDirection'}, //[可选]分页参数
        keys         : {statusCode:'statusCode', message:'message'}, //[可选]
        ui           : {
                         sidenavWidth     : 220,
                         showSlidebar     : true, //[可选]左侧导航栏锁定/隐藏
                         overwriteHomeTab : false //[可选]当打开一个未定义id的navtab时，是否可以覆盖主navtab(我的主页)
                       },
        debug        : true,    // [可选]调试模式 [true|false，默认false]
        theme        : 'green' // 若有Cookie['bjui_theme'],优先选择Cookie['bjui_theme']。皮肤[五种皮肤:default, orange, purple, blue, red, green]
    })
    //时钟
    var today = new Date(), time = today.getTime()
    $('#bjui-date').html(today.formatDate('yyyy/MM/dd'))
    setInterval(function() {
        today = new Date(today.setSeconds(today.getSeconds() + 1))
        $('#bjui-clock').html(today.formatDate('HH:mm:ss'))
    }, 1000)
})

/*window.onbeforeunload = function(){
    return "确定要关闭本系统 ?";
}*/

//菜单-事件-zTree
function MainMenuClick(event, treeId, treeNode) {
    if (treeNode.target && treeNode.target == 'dialog' || treeNode.target == 'navtab')
        event.preventDefault()
    
    if (treeNode.isParent) {
        var zTree = $.fn.zTree.getZTreeObj(treeId)
        
        zTree.expandNode(treeNode)
        return
    }
    
    if (treeNode.target && treeNode.target == 'dialog')
        $(event.target).dialog({id:treeNode.targetid, url:treeNode.url, title:treeNode.name})
    else if (treeNode.target && treeNode.target == 'navtab')
        $(event.target).navtab({id:treeNode.targetid, url:treeNode.url, title:treeNode.name, fresh:treeNode.fresh, external:treeNode.external})
}

// 满屏开关
var bjui_index_container = 'container_fluid'

function bjui_index_exchange() {
    bjui_index_container = bjui_index_container == 'container_fluid' ? 'container' : 'container_fluid'
    
    $('#bjui-top').find('> div').attr('class', bjui_index_container)
    $('#bjui-navbar').find('> div').attr('class', bjui_index_container)
    $('#bjui-body-box').find('> div').attr('class', bjui_index_container)
}
</script>
<!-- highlight && ZeroClipboard -->
<!-- <link href="assets/prettify.css" rel="stylesheet">//代码高亮
<script src="assets/prettify.js"></script> -->
<!-- <link href="assets/ZeroClipboard.css" rel="stylesheet">复制到剪贴板
<script src="assets/ZeroClipboard.js"></script> -->

</head>
<body>

     <header class="navbar bjui-header" id="bjui-navbar">
        <div class="container_fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" id="bjui-navbar-collapsebtn" data-toggle="collapsenavbar" data-target="#bjui-navbar-collapse" aria-expanded="false">
                    <i class="fa fa-angle-double-right"></i>
                </button>
                <a class="navbar-brand" onclick="switch_home()" style="color:#fff;cursor: pointer;"><i class="fa fa-leaf"></i><span class="pl-8">NB-loT数据平台</span></a>
            </div>
            <nav class="collapse navbar-collapse" id="bjui-navbar-collapse">
                <ul class="nav navbar-nav navbar-right" id="bjui-hnav-navbar">
                    <li class="active">
                        <a href="/nbsysmanage/account/getuserMenu" data-toggle="sidenav" data-id-key="targetid" style="display: none;"></a>
                    </li>
                    {{#unless role}}
                    <li class="dropdown">

                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="fa fa-bell"></i><span class="badge-danger alarm-num"></span>
                        </a>
                        <ul class="dropdown-menu alert-content">
                            <li class="list-title">
                                <a class="pl-8">最新公告</a>
                            </li>
                            <li class="list-group">
                                <div class="container  _scroll">
                                    <div class="_panel-box">
                                    </div>
                                </div>
                            </li>
                            <li class="list-details"><a  href="/announcement/messages" data-toggle="navtab" data-options="{id:'all_messages', title:'公告'}"><div style="padding: 4px 0px;"><i class="fa fa-navicon"></i><span class="pl-8">所有公告</span></div></a></li>
                        </ul>
                    </li>
                    {{/unless}}
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="fa fa-user"></i>
                        </a>
                        <ul class="dropdown-menu user-profile">
                            <li>
                                <a class="pl-8">{{uname}}</a>
                            </li>
                            <li class="divider"></li>
                            <li><a data-toggle="dialog" data-options="{id:'changePassword', url:'/nbsysmanage/changePasswordPage', title:'修改密码',mask:true,height:560,maxable:false}"><i class="fa fa-gear"></i><span class="pl-8">修改密码</span></a></li>
                            <li class="divider"></li>
                            <li><a href="/account/loginOut"><i class="fa fa-sign-out"></i><span class="pl-8">退出</span></a></li>
                        </ul>
                    </li> 
                </ul>
            </nav>
        </div>
    </header>
    <div id="bjui-body-box">
        <div class="container_fluid" id="bjui-body">
            <div id="bjui-sidenav-col">
                <div id="bjui-sidenav">
                    <div id="bjui-sidenav-arrow" data-toggle="tooltip" data-placement="left" data-title="隐藏左侧菜单">
                        <i class="fa fa-long-arrow-left"></i>
                    </div>
                    <div id="bjui-sidenav-box">
                        
                    </div>
                </div>
            </div>
            <div id="bjui-navtab" class="tabsPage">
                <div id="bjui-sidenav-btn" data-toggle="tooltip" data-title="显示左侧菜单" data-placement="right">
                    <i class="fa fa-bars"></i>
                </div>
                <div class="tabsPageHeader">
                    <div class="tabsPageHeaderContent">
                        <ul class="navtab-tab nav nav-tabs">
                            <li ><a onclick="switch_home()" style="cursor: pointer;"><span><i class="fa fa-home"></i> #maintab#</span></a></li>
                        </ul>
                    </div>
                    <div class="tabsLeft"><i class="fa fa-angle-double-left"></i></div>
                    <div class="tabsRight"><i class="fa fa-angle-double-right"></i></div>
                    <div class="tabsMore"><i class="fa fa-angle-double-down"></i></div>
                </div>
                <ul class="tabsMoreList">
                    <li><a href="javascript:;">#maintab#</a></li>
                </ul>
                <div class="navtab-panel tabsPageContent">
                    <div class="navtabPage unitBox">
                        <div class="bjui-pageContent">
                             <div class="row pr-10">
                                <ul class="statistical-number">
                                <div class="clear"></div>
                            </ul>
                            </div>
                            <ul class="row col-36 pr-10">
                                <li>
                                    <div class="panel panel-default row-panel">
                                        <div class="panel-heading">
                                            设备趋势
                                        </div>
                                        <div class="panel-body">
                                            <div class="row">
                                                 <div class="date-input" style="display: block;">
                                                    <span class="position-relative">
                                                        <input type="text" id="daterange" class="form-control" style="width:60%;line-height: 36px">
                                                        <a class="date-icon dateIcon"><i class="fa fa-calendar"></i></a>
                                                    </span>
                                                    <button type="button" class="date-btn" style="margin-left: 6%" onclick="this_week_deviceNum(this)">本周</button>
                                                    <button type="button" class="date-btn hover" onclick="this_month_deviceNum(this)">本月</button>
                                                 </div>
                                                
                                            </div>
                                            
                                            <div id="device-line" style="height:400px;"></div>
                                        </div>
                                    </div>
                                </li>
                                
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="B-JUI/other/ie10-viewport-bug-workaround.js"></script>


    <script type="text/javascript">
    var initNavtal=0;//初始化navtal
   $('#device-line').width($('#device-line').parent().width()+160);
    var myChart1 = echarts.init(document.getElementById('device-line'));
    DD_roundies.addRule('.left-icon,#bjui-sidenav-arrow,.alarm-num,#bjui-sidenav-btn', '100px 100px', true);
    DD_roundies.addRule('.search-btn', '20px 20px', true);
    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', function () {
        history.pushState(null, null, document.URL);
    }); 
    $(document).ready(function(){
        $(".list-group").yi_scroll({
            "speed":25,
            "isMaxHeight":false,
            "barOffTop":2,
            "barOffBottom":2,
            "barOffRight":2,
            "boxWidth":4,
            "barWidth":4,
            "childPanel":"._panel-box",
            "boxClass":"_scroll_box",
            "barClass":"_scroll_bar",
            "barColor" : "rgba(0,0,0,0.3)",
            "barMDColor" : "rgba(255,255,255,0.5)",
            "boxColor" : "rgba(255,255,255,1)",
            "isBox":false,
            "isBar":false
        });
         $("#bjui-sidenav").yi_scroll({
            "speed":25,
            "isMaxHeight":false,
            "barOffTop":2,
            "barOffBottom":2,
            "barOffRight":2,
            "boxWidth":4,
            "barWidth":4,
            "childPanel":"#bjui-sidenav-box",
            "boxClass":"_scroll_box",
            "barClass":"_scroll_bar",
            "barColor" : "rgba(0,0,0,0.3)",
            "barMDColor" : "rgba(255,255,255,0.5)",
            "boxColor" : "rgba(255,255,255,1)",
            "isBox":false,
            "isBar":false
        });
        ajax_statistics();
        ajax_deivce_num();
        
        if('{{role}}'!='管理员'){
            get_unread_bulletin();
        }
        
        // timer();

        $('#daterange').daterangepicker({
            "startDate": $.get_month(),
            "endDate": $.get_today(),
            "maxDate":$.get_today(),
             "maxSpan": {
                "months": 1
            },
            locale: {  
                        format: "YYYY-MM-DD",  
                        separator: " 至 ",  
                        applyLabel: "确认",  
                        cancelLabel: "取消",  
                        fromLabel: "开始时间",  
                        toLabel: "结束时间",  
                        customRangeLabel: "自定义",  
                        daysOfWeek: ["日","一","二","三","四","五","六"],  
                        monthNames: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]  
                    }   

        });
        $('#daterange').on('apply.daterangepicker',function(ev, picker) {
            ajax_deivce_num(picker.startDate.format('YYYY-MM-DD'),picker.endDate.format('YYYY-MM-DD'));
        });
    })
    window.onresize=function(){
        $('#device-line').width($('#device-line').parent().width());
            myChart1.resize(); 
    }
    $(document).on(BJUI.eventType.initUI, function(event) {

        initNavtal++;
        if(initNavtal<3){
            BJUI.navtab('closeAllTab');
        }
    })
    function switch_home(){
        BJUI.navtab('switchTab', 'main');
        ajax_statistics();
        this_month_deviceNum();

    }
    function statistical_li(list){
         var roleName='{{role}}';
        if(roleName=='管理员'){
            $('.statistical-number').setStatistics(5,
                [
                    {'color':'cyan','icon':'fa-user','text':'用户','value':list.data.usernum,'id':'sysuser','url':'/sysmanage/user/list','title':'用户管理'},
                    {'color':'green','icon':'fa-desktop','text':'设备','value':list.data.devicenum,'id':'sysdevice','url':'/sysmanage/device/list','title':'设备管理'},
                    {'color':'brown','icon':'fa-file-o','text':'私有协议','value':list.data.ktvgroupnum,'id':'sysprotocol','url':'/sysmanage/protocol/list','title':'私有协议'},
                    {'color':'blue','icon':'fa-clipboard','text':'业务','value':list.data.businessnum,'id':'sysbusiness','url':'/sysmanage/business/list','title':'业务管理'},
                    {'color':'red','icon':'fa-th-large','text':'应用','value':list.data.appnum,'id':'sysapp','url':'/sysmanage/app/list','title':'应用管理'}
                    
                ])
        }else{
             $('.statistical-number').setStatistics(4,
                [
                    {'color':'green','icon':'fa-desktop','text':'设备','value':list.data.devicenum,'id':'sysdevice','url':'/sysmanage/device/list','title':'设备管理'},
                    {'color':'brown','icon':'fa-file-o','text':'私有协议','value':list.data.ktvgroupnum,'id':'sysprotocol','url':'/sysmanage/protocol/list','title':'私有协议'},
                    {'color':'blue','icon':'fa-clipboard','text':'业务','value':list.data.businessnum,'id':'sysbusiness','url':'/sysmanage/business/list','title':'业务管理'},
                    {'color':'red','icon':'fa-th-large','text':'应用','value':list.data.appnum,'id':'sysapp','url':'/sysmanage/app/list','title':'应用管理'}
                ])
        }
    }
    function click_jump(obj){
        BJUI.navtab({
            id:$(obj).attr('id'),
            url:$(obj).attr('url'),
            title:$(obj).attr('title'),
            fresh:true
        });
    }
    function ajax_statistics(){
        
        $.ajax({
            url:'/statistics/getStatistics',
            type:'post',
            dataType:'json',
            success:function(data){

                $('.statistical-number').empty();
                statistical_li(data);
            }
        }) 
    }
    function ajax_deivce_num(start,end){
        var startSelect,endSelect;
        if(!start){
            startSelect = $.get_month(); //默认值
        }else{
            startSelect = start;
        }
        if(!end){
            endSelect = $.get_today();
        }else{
            endSelect = end;
        }

        var startDate=new Date(Date.parse(startSelect.replace(/-/g,"/"))).getTime();
        var endDate= new Date(Date.parse(endSelect.replace(/-/g,"/"))).getTime();
        var cycleTimes=parseInt((endDate-startDate)/86400000)+1;                   //天数
        $.ajax({
            url:'/statistics/getIncreaseDeviceNum',
            type:'post',
            data:{'startDate':start,'endDate':end},
            dataType:'json',
            success:function(json){
                var data = generateData(cycleTimes,startDate,json.data.date,json.data.value);
                var option1 = {
                    color: ['#5793f3'],
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'cross'
                        }
                    },
                    toolbox: {
                        show: true,
                        feature: {
                            //dataView: {show:true,readOnly: false},
                            restore: {show:true},
                            saveAsImage: {show:true}
                        },
                        right:'4%'
                    },
                    
                    grid: {      
                        left: '3%',
                        right: '4%',
                        containLabel: true
                    },
                    xAxis : [
                        {
                            type : 'category',
                            data : data.categoryData, //图标下去的日期横轴
                            axisPointer: {
                                type: 'shadow'
                            }
                        }
                    ],
                    yAxis : [
                        {
                            type: 'value',
                            name: '设备数',
                            minInterval: 1
                        }
                    ],
                    dataZoom: [
                        {
                            show: true,
                            start: 0,
                            end: 100,
                        },
                        {
                            type: 'inside',
                            realtime: true,
                            start: 0,
                            end: 100
                        }
                    ],
                    series : [
                        {
                            name:'设备数',
                            type:'bar',
                            barWidth: '60%',
                            data:data.valueData
                        }
                    
                    ]
                };

                myChart1.setOption(option1, true);

            }
        })
    }
   
    function generateData(count,start,date,value) {
        var time = +new Date(start);
        var categoryData = [];
        var valueData = [];
        for (var i = 0; i < count; i++) {
            var dateData=echarts.format.formatTime('yyyy-MM-dd', time);
            categoryData.push(dateData);
            if($.inArray(dateData,date)=='-1'){
                valueData.push('0');
            }else{
                valueData.push(value[$.inArray(dateData,date)]);//找到dateData在数组date中的下标值
            }
            time += 86400000;
        }

        return {
            categoryData: categoryData,
            valueData: valueData
        };
    }
    
    function this_week_deviceNum(obj){
        var dateArr;
        var nowdate = new nowDate();                 
        var getWeekStartDate = new Date(nowdate.nowYear, nowdate.nowMonth, nowdate.nowDay - nowdate.nowDayOfWeek);
        $(obj).addClass('hover').siblings('button').removeClass('hover');
        $('#daterange').data('daterangepicker').setStartDate($.formatDate(getWeekStartDate));
        $('#daterange').data('daterangepicker').setEndDate($.get_today());
        dateArr=$('#daterange').val().split(' 至 ');
        ajax_deivce_num(dateArr[0],dateArr[1]);
    }

    function this_month_deviceNum(obj){
        var dateArr;
        var nowdate = new nowDate(); 
        var getMonthStartDate = new Date(nowdate.nowYear, nowdate.nowMonth, 1);
        $(obj).addClass('hover').siblings('button').removeClass('hover');
        $('#daterange').data('daterangepicker').setStartDate( $.formatDate(getMonthStartDate));
        $('#daterange').data('daterangepicker').setEndDate($.get_today());
        dateArr=$('#daterange').val().split(' 至 ');
        ajax_deivce_num(dateArr[0],dateArr[1]);
    }
    function get_unread_bulletin(num){
        $.ajax({
            url:'/announcement/mylist',
            type:'post',
            dataType:'json',
            success:function(data){
                $('._panel-box').empty();
                if(data.list.length==0){
                    $('.alarm-num').html('');
                    $('._panel-box').append('<p style="text-align: center;line-height: 160px;">暂无公告</p>');
                }else{
                    $('.alarm-num').html(data.list.length);
                    $.each(data.list,function(i,item){
                    $('._panel-box').append("<a onclick=\"on_read_bulletin(this)\" data-title='"+item.title+"' data-content='"+item.content+"' data-id='"+item.announcementid+"'><div class='media'><div class='media-left'><i class='fa fa-tasks fa-tasks-small'></i></div><div class='media-right'><p class='pl-8 m0'>"+item.title+"</p><span class='pl-8 fs12'>"+item.createdate+"</span></div></div></a>")
                        
                    })
                }
                if($('[title="公告"]') && data.list.length>=num){
                    BJUI.navtab('refresh', 'all_messages')
                }
                timer(data.list.length);
            }
        })
    }
    function ann_read(id){
        $.ajax({
            url:'/announcement/read',
            type:'post',
            data:{'id':id},
            dataType:'json',
            success:function(data){
                if(data.statusCode==200){
                    $('._panel-box').empty();
                    get_unread_bulletin();
                }
            }
        })
    }
    function on_read_bulletin(obj){
        ann_read($(obj).attr('data-id'));
        if($('[title="公告"]') && $('.all-messages').find('[data-id="'+$(obj).attr('data-id')+'"]')){
            $('.all-messages').find('[data-id="'+$(obj).attr('data-id')+'"] i').remove();
        }
        BJUI.dialog({
            id:'read_bulletin',
            mask:true,
            maxable:false,
            html:'<div class="bjui-pageContent"><p class="change-line plr-10">'+$(obj).attr('data-content')+'</p></div><div class="btns-group bjui-pageFooter"><button onclick="BJUI.dialog(\'closeCurrent\');" class="save-btn">确定</button></div>',
            title:$(obj).attr('data-title')
        })
    }
    function timer(num){
        var t=setTimeout("get_unread_bulletin("+num+")",60000);
    }

</script>
</body>
</html>